﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using HodelBll;
using IHodelBll;
using Model;
using Microsoft.Extensions.Logging;

namespace HotelUI.Controllers
{
    public class DishsController : Controller
    {

   
        IDishiBll _dishiBll;

        public DishsController(IDishiBll dishiBll )
        {
            _dishiBll = dishiBll;
        }
            public IActionResult Index() 
        {
            return View();
        } 
        [HttpGet]
        public IActionResult GetDishInfo()
        {
            return View();
        }
        /// <summary>
        /// 菜品列表
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        [HttpGet]
        public List<DishesInfo> GetInfo(string name )
        {
            
            List<DishesInfo> list = _dishiBll.GetDishes();
            if (!string.IsNullOrEmpty(name))
            {
                list = list.Where(c => c.DishName.Contains(name)).ToList();
            }
          //  list = list.Take(pageSize).Skip(0).ToList();
            return list;
        }
        /// <summary>
        /// 显示菜品分类
        /// </summary>
        /// <returns></returns>
      [HttpGet]
        public List<DishLei> GetDishLeis()
        {
            return _dishiBll.GetDishLeis();
        }
        /// <summary>
        /// 删除菜品
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
    [HttpGet]
        public int DelDish(int id)
        {
            return _dishiBll.DelDish(id);
        }

        /// <summary>
        /// 添加菜品视图
        /// </summary>
        /// <returns></returns>
        public IActionResult AddDishInfo()
        {
            return View();
        }
        public int AddDish(DishesInfo info)
        {
            return _dishiBll.AddDish(info);
        
        }
        /// <summary>
        /// 菜品销售单视图
        /// </summary>
        /// <returns></returns>
     [HttpGet]
        public IActionResult GetDishSales()
        {
            return View();
        }
        [HttpGet]
        public List<DishSalesInfo> GetSalesInfos()
        {
            List<DishSalesInfo> list = _dishiBll.GetDishSales();
            return list;
        
        }
  




    }
}
